package com.learn.use.myreconsituteproject.mvp;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

/**
 * Created by 聪明一只哈 on 2018/4/10.
 * Time: 2018/4/10  9:09
 */

public abstract class BaseActivity<V,T extends BasePresenter<V>> extends AppCompatActivity {

    public T mPresenter;


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mPresenter=creatPresenter();
        mPresenter.attachView((V)this);
    }


    protected abstract T creatPresenter();

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mPresenter.dettachView();
    }
}
